<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p>定义一个函数，可以传入的半径来计算圆的面积，并返回计算结果(圆的面积公式:π *r*r) 在函数外打印出圆的面积</p>
    <input type="text" id="sum">
    <button id="btn">点击计算圆的面积</button>
</body>
</html>

<script>
    function calculateCircle() {
        var radius = prompt("Enter the radius of the circle:");
        var area = Math.PI * radius * radius;
        var circumference = 2 * Math.PI * radius;
        alert("Area: " + area + "\nCircumference: " + circumference);
    }

    document.getElementById('btn').onclick = calculateCircle;


    calculateCircle();


    // function mian(radius) {
    //     return Math.PI * radius * radius;
    // }

    // const radius = parseFloat(prompt("输入圆的半径:"));
    // const area = mian(radius);
    // const zhouc = 2 * Math.PI * radius;

    // console.log(`面积: ${area}`);
    // console.log(`周长: ${zhouc}`);

    // function cca(radius) {
    //     return Math.PI * radius * radius;
    // }

    // console.log(cca(prompt("Enter the radius of the circle:")));

</script>